package com.cloud.xuehua.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@Service
public class OrderService {

    @Autowired
    private IdGeneratorSnowflake idGenerator;

    public String getXueHua() {


        ExecutorService executorService = Executors.newFixedThreadPool(5);
        System.out.println(executorService);
//        for (int i = 0; i < 20; i++) {
//            executorService.submit(()->{
//                long l = idGenerator.snowflakeId();
//                System.out.println(l);
//            });
//        }


                for (int i = 0; i < 20; i++) {

                long l = idGenerator.snowflakeId();
                System.out.println(l);

        }


        return "hello";

    }
}
